From: Wei Liu Date: Wed, 25 Feb 2015 14:56:03 +0000 (+0000) Subject: gentypes: zero out structure in _dispose function X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3683 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=d0b80baa985b516fb08ca206c69c5905e816cceb;p=xen.git gentypes: zero out structure in _dispose function Original the structure was memset to a poison value. That prevented _dispose to be made idempotent. We should stop doing so. Memseting the structure to 0 makes all pointers in structure become NULL, which can be handled by free(). Signed-off-by: Wei Liu Cc: Ian Campbell Cc: Ian Jackson Acked-by: Ian Campbell --- diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index d9e14fde67..afd4eeab03 100644 --- a/tools/libxl/gentypes.py +++ b/tools/libxl/gentypes.py @@ -636,7 +636,6 @@ if __name__ == '__main__': #include "libxl_internal.h" -#define LIBXL_DTOR_POISON 0xa5 """ % " ".join(sys.argv)) @@ -644,7 +643,7 @@ if __name__ == '__main__': f.write("void %s(%s)\n" % (ty.dispose_fn, ty.make_arg("p"))) f.write("{\n") f.write(libxl_C_type_dispose(ty, "p")) - f.write(" memset(p, LIBXL_DTOR_POISON, sizeof(*p));\n") + f.write(" memset(p, 0, sizeof(*p));\n") f.write("}\n") f.write("\n")